<?php
class cls_control_groupbuy extends cls_control_base
{
	function current_group_buy()
	{
		$group_serve=cls_data_base::get_instance($this->name);
		$current_group_buy=$group_serve->current_group_buy();
		$time = strtotime($current_group_buy['EndTime'])-time();
		$hour= round($time/3600);
		$current_group_buy['hour']=$hour;
		echo json_encode($current_group_buy);
	}
	function next_group_buy()
	{
		$group_serve=cls_data_base::get_instance($this->name);
		$next_group_buy=$group_serve->next_group_buy();
		$time = strtotime($next_group_buy['StartTime'])-time();
		$hour= round($time/3600);
		$next_group_buy['hour']=$hour;
		echo json_encode($next_group_buy);
	}
	function current_group_buy_product()
	{
		$group_serve=cls_data_base::get_instance($this->name);
		$current_group_buy=$group_serve->current_group_buy();
		$_REQUEST['discount_id']=$current_group_buy['ID'];
		$search_control=cls_control_base::get_instance('search');
		$search_control->discount_search();
	}
	function next_group_buy_product()
	{
		$group_serve=cls_data_base::get_instance($this->name);
		$next_group_buy=$group_serve->next_group_buy();
		$_REQUEST['discount_id']=$next_group_buy['ID'];
		$search_control=cls_control_base::get_instance('search');
		$search_control->discount_search();
	}
}